#include<bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	cin>>s;
	int max_letter = *max_element(s.begin(), s.end());
	int len = s.size();
	for(int i = 0;i < len;i++)
	{
		if(s[i] == max_letter)
		{
			s.insert(i+1, "(max)");
			i += 5;
			len += 5;
		}
	}
	cout<<s;
	return 0;
}

